package com.epic.eventmgr.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component("eventListener")
public class eventListener implements ApplicationListener<ContextRefreshedEvent> {
    private static Logger logger =  LoggerFactory.getLogger(eventListener.class);
    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
//        logger.info("partent " + contextRefreshedEvent.getApplicationContext().getParent());
        logger.info("event start");
        logger.info("event end");
    }
}
/**
 * 这里没执行，1.要在xml配置包扫描 2.要加上Component注解
 *
 * 在多个app 时 rest 里面不能出现多个application name 配置 只能出现一个
 * service 层的可以
 */
